
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>与其它构建工具整合 · TypeScript Handbook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="Patrick Zhong">
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="Nightly Builds.html" />
    
    
    <link rel="prev" href="Compiler Options in MSBuild.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="tutorials/">
            
                <a href="tutorials/">
            
                    
                    快速上手
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="tutorials/TypeScript in 5 minutes.html">
            
                <a href="tutorials/TypeScript in 5 minutes.html">
            
                    
                    5分钟了解TypeScript
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="tutorials/ASP.NET Core.html">
            
                <a href="tutorials/ASP.NET Core.html">
            
                    
                    ASP.NET Core
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="tutorials/ASP.NET 4.html">
            
                <a href="tutorials/ASP.NET 4.html">
            
                    
                    ASP.NET 4
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="tutorials/Gulp.html">
            
                <a href="tutorials/Gulp.html">
            
                    
                    Gulp
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="tutorials/Knockout.html">
            
                <a href="tutorials/Knockout.html">
            
                    
                    Knockout.js
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="tutorials/React & Webpack.html">
            
                <a href="tutorials/React & Webpack.html">
            
                    
                    React与webpack
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.7" data-path="tutorials/React.html">
            
                <a href="tutorials/React.html">
            
                    
                    React
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.8" data-path="tutorials/Angular 2.html">
            
                <a href="tutorials/Angular 2.html">
            
                    
                    Angular 2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.9" data-path="tutorials/Migrating from JavaScript.html">
            
                <a href="tutorials/Migrating from JavaScript.html">
            
                    
                    从JavaScript迁移到TypeScript
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="./">
            
                <a href="./">
            
                    
                    手册
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="Basic Types.html">
            
                <a href="Basic Types.html">
            
                    
                    基础类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="Variable Declarations.html">
            
                <a href="Variable Declarations.html">
            
                    
                    变量声明
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="Interfaces.html">
            
                <a href="Interfaces.html">
            
                    
                    接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="Classes.html">
            
                <a href="Classes.html">
            
                    
                    类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="Functions.html">
            
                <a href="Functions.html">
            
                    
                    函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.6" data-path="Generics.html">
            
                <a href="Generics.html">
            
                    
                    泛型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.7" data-path="Enums.html">
            
                <a href="Enums.html">
            
                    
                    枚举
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.8" data-path="Type Inference.html">
            
                <a href="Type Inference.html">
            
                    
                    类型推论
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.9" data-path="Type Compatibility.html">
            
                <a href="Type Compatibility.html">
            
                    
                    类型兼容性
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.10" data-path="Advanced Types.html">
            
                <a href="Advanced Types.html">
            
                    
                    高级类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.11" data-path="Utilit Types.md">
            
                <span>
            
                    
                    实用工具类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.12" data-path="Symbols.html">
            
                <a href="Symbols.html">
            
                    
                    Symbols
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.13" data-path="Iterators and Generators.html">
            
                <a href="Iterators and Generators.html">
            
                    
                    Iterators 和 Generators
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.14" data-path="Modules.html">
            
                <a href="Modules.html">
            
                    
                    模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.15" data-path="Namespaces.html">
            
                <a href="Namespaces.html">
            
                    
                    命名空间
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.16" data-path="Namespaces and Modules.html">
            
                <a href="Namespaces and Modules.html">
            
                    
                    命名空间和模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.17" data-path="Module Resolution.html">
            
                <a href="Module Resolution.html">
            
                    
                    模块解析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.18" data-path="Declaration Merging.html">
            
                <a href="Declaration Merging.html">
            
                    
                    声明合并
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.19" data-path="Writing Definition Files.html">
            
                <a href="Writing Definition Files.html">
            
                    
                    书写.d.ts文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.20" data-path="JSX.html">
            
                <a href="JSX.html">
            
                    
                    JSX
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.21" data-path="Decorators.html">
            
                <a href="Decorators.html">
            
                    
                    Decorators
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.22" data-path="Mixins.html">
            
                <a href="Mixins.html">
            
                    
                    混入
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.23" data-path="Triple-Slash Directives.html">
            
                <a href="Triple-Slash Directives.html">
            
                    
                    三斜线指令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.24" data-path="Type Checking JavaScript Files.html">
            
                <a href="Type Checking JavaScript Files.html">
            
                    
                    JavaScript文件里的类型检查
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="declaration files/Introduction.html">
            
                <a href="declaration files/Introduction.html">
            
                    
                    如何书写声明文件
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="declaration files/Library Structures.html">
            
                <a href="declaration files/Library Structures.html">
            
                    
                    结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="declaration files/Do's and Don'ts.html">
            
                <a href="declaration files/Do's and Don'ts.html">
            
                    
                    规范
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="declaration files/By Example.html">
            
                <a href="declaration files/By Example.html">
            
                    
                    举例
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="declaration files/Deep Dive.html">
            
                <a href="declaration files/Deep Dive.html">
            
                    
                    深入
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="declaration files/Publishing.html">
            
                <a href="declaration files/Publishing.html">
            
                    
                    发布
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6" data-path="declaration files/Consumption.html">
            
                <a href="declaration files/Consumption.html">
            
                    
                    使用
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="tsconfig.json.html">
            
                <a href="tsconfig.json.html">
            
                    
                    工程配置
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="tsconfig.json.html">
            
                <a href="tsconfig.json.html">
            
                    
                    tsconfig.json
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="Project References.html">
            
                <a href="Project References.html">
            
                    
                    工程引用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="Typings for NPM Packages.html">
            
                <a href="Typings for NPM Packages.html">
            
                    
                    NPM包的类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="Compiler Options.html">
            
                <a href="Compiler Options.html">
            
                    
                    编译选项
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="Configuring Watch.html">
            
                <a href="Configuring Watch.html">
            
                    
                    配置 Watch
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.6" data-path="Compiler Options in MSBuild.html">
            
                <a href="Compiler Options in MSBuild.html">
            
                    
                    在MSBuild里使用编译选项
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.5.7" data-path="Integrating with Build Tools.html">
            
                <a href="Integrating with Build Tools.html">
            
                    
                    与其它构建工具整合
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.8" data-path="Nightly Builds.html">
            
                <a href="Nightly Builds.html">
            
                    
                    使用TypeScript的每日构建版本
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../wiki/">
            
                <a href="../wiki/">
            
                    
                    Wiki
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../wiki/this-in-TypeScript.html">
            
                <a href="../wiki/this-in-TypeScript.html">
            
                    
                    TypeScript里的this
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../wiki/coding_guidelines.html">
            
                <a href="../wiki/coding_guidelines.html">
            
                    
                    编码规范
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="../wiki/Common Errors.html">
            
                <a href="../wiki/Common Errors.html">
            
                    
                    常见编译错误
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="../wiki/TypeScript-Editor-Support.html">
            
                <a href="../wiki/TypeScript-Editor-Support.html">
            
                    
                    支持TypeScript的编辑器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="../wiki/Using-TypeScript-With-ASP.NET-5.html">
            
                <a href="../wiki/Using-TypeScript-With-ASP.NET-5.html">
            
                    
                    结合ASP.NET v5使用TypeScript
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6" data-path="../wiki/Architectural-Overview.html">
            
                <a href="../wiki/Architectural-Overview.html">
            
                    
                    架构概述
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.7" data-path="../wiki/Roadmap.html">
            
                <a href="../wiki/Roadmap.html">
            
                    
                    发展路线图
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../release-notes/">
            
                <a href="../release-notes/">
            
                    
                    新增功能
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../release-notes/TypeScript 3.1.html">
            
                <a href="../release-notes/TypeScript 3.1.html">
            
                    
                    TypeScript 3.1
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../release-notes/TypeScript 3.0.html">
            
                <a href="../release-notes/TypeScript 3.0.html">
            
                    
                    TypeScript 3.0
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="../release-notes/TypeScript 2.9.html">
            
                <a href="../release-notes/TypeScript 2.9.html">
            
                    
                    TypeScript 2.9
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4" data-path="../release-notes/TypeScript 2.8.html">
            
                <a href="../release-notes/TypeScript 2.8.html">
            
                    
                    TypeScript 2.8
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.5" data-path="../release-notes/TypeScript 2.7.html">
            
                <a href="../release-notes/TypeScript 2.7.html">
            
                    
                    TypeScript 2.7
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6" data-path="../release-notes/TypeScript 2.6.html">
            
                <a href="../release-notes/TypeScript 2.6.html">
            
                    
                    TypeScript 2.6
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.7" data-path="../release-notes/TypeScript 2.5.html">
            
                <a href="../release-notes/TypeScript 2.5.html">
            
                    
                    TypeScript 2.5
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.8" data-path="../release-notes/TypeScript 2.4.html">
            
                <a href="../release-notes/TypeScript 2.4.html">
            
                    
                    TypeScript 2.4
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.9" data-path="../release-notes/TypeScript 2.3.html">
            
                <a href="../release-notes/TypeScript 2.3.html">
            
                    
                    TypeScript 2.3
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.10" data-path="../release-notes/TypeScript 2.2.html">
            
                <a href="../release-notes/TypeScript 2.2.html">
            
                    
                    TypeScript 2.2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.11" data-path="../release-notes/TypeScript 2.1.html">
            
                <a href="../release-notes/TypeScript 2.1.html">
            
                    
                    TypeScript 2.1
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.12" data-path="../release-notes/TypeScript 2.0.html">
            
                <a href="../release-notes/TypeScript 2.0.html">
            
                    
                    TypeScript 2.0
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.13" data-path="../release-notes/TypeScript 1.8.html">
            
                <a href="../release-notes/TypeScript 1.8.html">
            
                    
                    TypeScript 1.8
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.14" data-path="../release-notes/TypeScript 1.7.html">
            
                <a href="../release-notes/TypeScript 1.7.html">
            
                    
                    TypeScript 1.7
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.15" data-path="../release-notes/TypeScript 1.6.html">
            
                <a href="../release-notes/TypeScript 1.6.html">
            
                    
                    TypeScript 1.6
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.16" data-path="../release-notes/TypeScript 1.5.html">
            
                <a href="../release-notes/TypeScript 1.5.html">
            
                    
                    TypeScript 1.5
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.17" data-path="../release-notes/TypeScript 1.4.html">
            
                <a href="../release-notes/TypeScript 1.4.html">
            
                    
                    TypeScript 1.4
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.18" data-path="../release-notes/TypeScript 1.3.html">
            
                <a href="../release-notes/TypeScript 1.3.html">
            
                    
                    TypeScript 1.3
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.19" data-path="../release-notes/TypeScript 1.1.html">
            
                <a href="../release-notes/TypeScript 1.1.html">
            
                    
                    TypeScript 1.1
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../breaking-changes/breaking-changes.html">
            
                <a href="../breaking-changes/breaking-changes.html">
            
                    
                    Breaking Changes
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../breaking-changes/TypeScript 2.4.html">
            
                <a href="../breaking-changes/TypeScript 2.4.html">
            
                    
                    TypeScript 2.4
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="../breaking-changes/TypeScript 2.3.html">
            
                <a href="../breaking-changes/TypeScript 2.3.html">
            
                    
                    TypeScript 2.3
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.3" data-path="../breaking-changes/TypeScript 2.2.html">
            
                <a href="../breaking-changes/TypeScript 2.2.html">
            
                    
                    TypeScript 2.2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.4" data-path="../breaking-changes/TypeScript 2.1.html">
            
                <a href="../breaking-changes/TypeScript 2.1.html">
            
                    
                    TypeScript 2.1
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.5" data-path="../breaking-changes/TypeScript 2.0.html">
            
                <a href="../breaking-changes/TypeScript 2.0.html">
            
                    
                    TypeScript 2.0
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.6" data-path="../breaking-changes/TypeScript 1.8.html">
            
                <a href="../breaking-changes/TypeScript 1.8.html">
            
                    
                    TypeScript 1.8
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.7" data-path="../breaking-changes/TypeScript 1.7.html">
            
                <a href="../breaking-changes/TypeScript 1.7.html">
            
                    
                    TypeScript 1.7
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.8" data-path="../breaking-changes/TypeScript 1.6.html">
            
                <a href="../breaking-changes/TypeScript 1.6.html">
            
                    
                    TypeScript 1.6
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.9" data-path="../breaking-changes/TypeScript 1.5.html">
            
                <a href="../breaking-changes/TypeScript 1.5.html">
            
                    
                    TypeScript 1.5
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.10" data-path="../breaking-changes/TypeScript 1.4.html">
            
                <a href="../breaking-changes/TypeScript 1.4.html">
            
                    
                    TypeScript 1.4
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >与其它构建工具整合</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <p>Build tools</p>
<ul>
<li><a href="#browserify">Browserify</a></li>
<li><a href="#duo">Duo</a></li>
<li><a href="#grunt">Grunt</a></li>
<li><a href="#gulp">Gulp</a></li>
<li><a href="#jspm">Jspm</a></li>
<li><a href="#webpack">Webpack</a></li>
<li><a href="#msbuild">MSBuild</a></li>
<li><a href="#nuget">NuGet</a></li>
</ul>
<h1 id="browserify">Browserify</h1>
<h3 id="&#x5B89;&#x88C5;">&#x5B89;&#x88C5;</h3>
<pre><code class="lang-sh">npm install tsify
</code></pre>
<h3 id="&#x4F7F;&#x7528;&#x547D;&#x4EE4;&#x884C;&#x4EA4;&#x4E92;">&#x4F7F;&#x7528;&#x547D;&#x4EE4;&#x884C;&#x4EA4;&#x4E92;</h3>
<pre><code class="lang-sh">browserify main.ts -p [ tsify --noImplicitAny ] &gt; bundle.js
</code></pre>
<h3 id="&#x4F7F;&#x7528;api">&#x4F7F;&#x7528;API</h3>
<pre><code class="lang-js"><span class="hljs-keyword">var</span> browserify = <span class="hljs-built_in">require</span>(<span class="hljs-string">&quot;browserify&quot;</span>);
<span class="hljs-keyword">var</span> tsify = <span class="hljs-built_in">require</span>(<span class="hljs-string">&quot;tsify&quot;</span>);

browserify()
    .add(<span class="hljs-string">&apos;main.ts&apos;</span>)
    .plugin(<span class="hljs-string">&apos;tsify&apos;</span>, { noImplicitAny: <span class="hljs-literal">true</span> })
    .bundle()
    .pipe(process.stdout);
</code></pre>
<p>&#x66F4;&#x591A;&#x8BE6;&#x7EC6;&#x4FE1;&#x606F;&#xFF1A;<a href="https://github.com/smrq/tsify" target="_blank">smrq/tsify</a></p>
<h1 id="duo">Duo</h1>
<h3 id="&#x5B89;&#x88C5;">&#x5B89;&#x88C5;</h3>
<pre><code class="lang-sh">npm install duo-typescript
</code></pre>
<h3 id="&#x4F7F;&#x7528;&#x547D;&#x4EE4;&#x884C;&#x4EA4;&#x4E92;">&#x4F7F;&#x7528;&#x547D;&#x4EE4;&#x884C;&#x4EA4;&#x4E92;</h3>
<pre><code class="lang-sh">duo --use duo-typescript entry.ts
</code></pre>
<h3 id="&#x4F7F;&#x7528;api">&#x4F7F;&#x7528;API</h3>
<pre><code class="lang-js"><span class="hljs-keyword">var</span> Duo = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;duo&apos;</span>);
<span class="hljs-keyword">var</span> fs = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;fs&apos;</span>)
<span class="hljs-keyword">var</span> path = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;path&apos;</span>)
<span class="hljs-keyword">var</span> typescript = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;duo-typescript&apos;</span>);

<span class="hljs-keyword">var</span> out = path.join(__dirname, <span class="hljs-string">&quot;output.js&quot;</span>)

Duo(__dirname)
    .entry(<span class="hljs-string">&apos;entry.ts&apos;</span>)
    .use(typescript())
    .run(<span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">err, results</span>) </span>{
        <span class="hljs-keyword">if</span> (err) <span class="hljs-keyword">throw</span> err;
        <span class="hljs-comment">// Write compiled result to output file</span>
        fs.writeFileSync(out, results.code);
    });
</code></pre>
<p>&#x66F4;&#x591A;&#x8BE6;&#x7EC6;&#x4FE1;&#x606F;&#xFF1A;<a href="https://github.com/frankwallis/duo-typescript" target="_blank">frankwallis/duo-typescript</a></p>
<h1 id="grunt">Grunt</h1>
<h3 id="&#x5B89;&#x88C5;">&#x5B89;&#x88C5;</h3>
<pre><code class="lang-sh">npm install grunt-ts
</code></pre>
<h3 id="&#x57FA;&#x672C;gruntfilejs">&#x57FA;&#x672C;Gruntfile.js</h3>
<pre><code class="lang-js"><span class="hljs-built_in">module</span>.exports = <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">grunt</span>) </span>{
    grunt.initConfig({
        ts: {
            <span class="hljs-keyword">default</span> : {
                src: [<span class="hljs-string">&quot;**/*.ts&quot;</span>, <span class="hljs-string">&quot;!node_modules/**/*.ts&quot;</span>]
            }
        }
    });
    grunt.loadNpmTasks(<span class="hljs-string">&quot;grunt-ts&quot;</span>);
    grunt.registerTask(<span class="hljs-string">&quot;default&quot;</span>, [<span class="hljs-string">&quot;ts&quot;</span>]);
};
</code></pre>
<p>&#x66F4;&#x591A;&#x8BE6;&#x7EC6;&#x4FE1;&#x606F;&#xFF1A;<a href="https://github.com/TypeStrong/grunt-ts" target="_blank">TypeStrong/grunt-ts</a></p>
<h1 id="gulp">Gulp</h1>
<h3 id="&#x5B89;&#x88C5;">&#x5B89;&#x88C5;</h3>
<pre><code class="lang-sh">npm install gulp-typescript
</code></pre>
<h3 id="&#x57FA;&#x672C;gulpfilejs">&#x57FA;&#x672C;gulpfile.js</h3>
<pre><code class="lang-js"><span class="hljs-keyword">var</span> gulp = <span class="hljs-built_in">require</span>(<span class="hljs-string">&quot;gulp&quot;</span>);
<span class="hljs-keyword">var</span> ts = <span class="hljs-built_in">require</span>(<span class="hljs-string">&quot;gulp-typescript&quot;</span>);

gulp.task(<span class="hljs-string">&quot;default&quot;</span>, <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
    <span class="hljs-keyword">var</span> tsResult = gulp.src(<span class="hljs-string">&quot;src/*.ts&quot;</span>)
        .pipe(ts({
              noImplicitAny: <span class="hljs-literal">true</span>,
              out: <span class="hljs-string">&quot;output.js&quot;</span>
        }));
    <span class="hljs-keyword">return</span> tsResult.js.pipe(gulp.dest(<span class="hljs-string">&apos;built/local&apos;</span>));
});
</code></pre>
<p>&#x66F4;&#x591A;&#x8BE6;&#x7EC6;&#x4FE1;&#x606F;&#xFF1A;<a href="https://github.com/ivogabe/gulp-typescript" target="_blank">ivogabe/gulp-typescript</a></p>
<h1 id="jspm">Jspm</h1>
<h3 id="&#x5B89;&#x88C5;">&#x5B89;&#x88C5;</h3>
<pre><code class="lang-sh">npm install -g jspm@beta
</code></pre>
<p><em>&#x6CE8;&#x610F;&#xFF1A;&#x76EE;&#x524D;jspm&#x7684;0.16beta&#x7248;&#x672C;&#x652F;&#x6301;TypeScript</em></p>
<p>&#x66F4;&#x591A;&#x8BE6;&#x7EC6;&#x4FE1;&#x606F;&#xFF1A;<a href="https://github.com/Microsoft/TypeScriptSamples/tree/master/jspm" target="_blank">TypeScriptSamples/jspm</a></p>
<h1 id="webpack">Webpack</h1>
<h3 id="&#x5B89;&#x88C5;">&#x5B89;&#x88C5;</h3>
<pre><code class="lang-sh">npm install ts-loader --save-dev
</code></pre>
<h3 id="&#x57FA;&#x672C;webpackconfigjs">&#x57FA;&#x672C;webpack.config.js</h3>
<pre><code class="lang-js"><span class="hljs-built_in">module</span>.exports = {
    entry: <span class="hljs-string">&quot;./src/index.tsx&quot;</span>,
    output: {
        filename: <span class="hljs-string">&quot;bundle.js&quot;</span>
    },
    resolve: {
        <span class="hljs-comment">// Add &apos;.ts&apos; and &apos;.tsx&apos; as a resolvable extension.</span>
        extensions: [<span class="hljs-string">&quot;&quot;</span>, <span class="hljs-string">&quot;.webpack.js&quot;</span>, <span class="hljs-string">&quot;.web.js&quot;</span>, <span class="hljs-string">&quot;.ts&quot;</span>, <span class="hljs-string">&quot;.tsx&quot;</span>, <span class="hljs-string">&quot;.js&quot;</span>]
    },
    <span class="hljs-built_in">module</span>: {
        loaders: [
            <span class="hljs-comment">// all files with a &apos;.ts&apos; or &apos;.tsx&apos; extension will be handled by &apos;ts-loader&apos;</span>
            { test: <span class="hljs-regexp">/\.tsx?$/</span>, loader: <span class="hljs-string">&quot;ts-loader&quot;</span> }
        ]
    }
};
</code></pre>
<p>&#x67E5;&#x770B;<a href="https://www.npmjs.com/package/ts-loader" target="_blank">&#x66F4;&#x591A;&#x5173;&#x4E8E;ts-loader&#x7684;&#x8BE6;&#x7EC6;&#x4FE1;&#x606F;</a></p>
<p>&#x6216;&#x8005;</p>
<ul>
<li><a href="https://www.npmjs.com/package/awesome-typescript-loader" target="_blank">awesome-typescript-loader</a></li>
</ul>
<h1 id="msbuild">MSBuild</h1>
<p>&#x66F4;&#x65B0;&#x5DE5;&#x7A0B;&#x6587;&#x4EF6;&#xFF0C;&#x5305;&#x542B;&#x672C;&#x5730;&#x5B89;&#x88C5;&#x7684;<code>Microsoft.TypeScript.Default.props</code>&#xFF08;&#x5728;&#x9876;&#x7AEF;&#xFF09;&#x548C;<code>Microsoft.TypeScript.targets</code>&#xFF08;&#x5728;&#x5E95;&#x90E8;&#xFF09;&#x6587;&#x4EF6;&#xFF1A;</p>
<pre><code class="lang-xml"><span class="php"><span class="hljs-meta">&lt;?</span>xml version=<span class="hljs-string">&quot;1.0&quot;</span> encoding=<span class="hljs-string">&quot;utf-8&quot;</span><span class="hljs-meta">?&gt;</span></span>
<span class="hljs-tag">&lt;<span class="hljs-name">Project</span> <span class="hljs-attr">ToolsVersion</span>=<span class="hljs-string">&quot;4.0&quot;</span> <span class="hljs-attr">DefaultTargets</span>=<span class="hljs-string">&quot;Build&quot;</span> <span class="hljs-attr">xmlns</span>=<span class="hljs-string">&quot;http://schemas.microsoft.com/developer/msbuild/2003&quot;</span>&gt;</span>
  <span class="hljs-comment">&lt;!-- Include default props at the top --&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">Import</span>
      <span class="hljs-attr">Project</span>=<span class="hljs-string">&quot;$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props&quot;</span>
      <span class="hljs-attr">Condition</span>=<span class="hljs-string">&quot;Exists(&apos;$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props&apos;)&quot;</span> /&gt;</span>

  <span class="hljs-comment">&lt;!-- TypeScript configurations go here --&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">PropertyGroup</span> <span class="hljs-attr">Condition</span>=<span class="hljs-string">&quot;&apos;$(Configuration)&apos; == &apos;Debug&apos;&quot;</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">TypeScriptRemoveComments</span>&gt;</span>false<span class="hljs-tag">&lt;/<span class="hljs-name">TypeScriptRemoveComments</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">TypeScriptSourceMap</span>&gt;</span>true<span class="hljs-tag">&lt;/<span class="hljs-name">TypeScriptSourceMap</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">PropertyGroup</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">PropertyGroup</span> <span class="hljs-attr">Condition</span>=<span class="hljs-string">&quot;&apos;$(Configuration)&apos; == &apos;Release&apos;&quot;</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">TypeScriptRemoveComments</span>&gt;</span>true<span class="hljs-tag">&lt;/<span class="hljs-name">TypeScriptRemoveComments</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">TypeScriptSourceMap</span>&gt;</span>false<span class="hljs-tag">&lt;/<span class="hljs-name">TypeScriptSourceMap</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">PropertyGroup</span>&gt;</span>

  <span class="hljs-comment">&lt;!-- Include default targets at the bottom --&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">Import</span>
      <span class="hljs-attr">Project</span>=<span class="hljs-string">&quot;$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets&quot;</span>
      <span class="hljs-attr">Condition</span>=<span class="hljs-string">&quot;Exists(&apos;$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets&apos;)&quot;</span> /&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">Project</span>&gt;</span>
</code></pre>
<p>&#x5173;&#x4E8E;&#x914D;&#x7F6E;MSBuild&#x7F16;&#x8BD1;&#x5668;&#x9009;&#x9879;&#x7684;&#x66F4;&#x591A;&#x8BE6;&#x7EC6;&#x4FE1;&#x606F;&#xFF0C;&#x8BF7;&#x53C2;&#x8003;&#xFF1A;<a href="Compiler%20Options%20in%20MSBuild.md">&#x5728;MSBuild&#x91CC;&#x4F7F;&#x7528;&#x7F16;&#x8BD1;&#x9009;&#x9879;</a></p>
<h1 id="nuget">NuGet</h1>
<ul>
<li>&#x53F3;&#x952E;&#x70B9;&#x51FB; -&gt; Manage NuGet Packages</li>
<li>&#x67E5;&#x627E;<code>Microsoft.TypeScript.MSBuild</code></li>
<li>&#x70B9;&#x51FB;<code>Install</code></li>
<li>&#x5B89;&#x88C5;&#x5B8C;&#x6210;&#x540E;&#xFF0C;Rebuild&#x3002;</li>
</ul>
<p>&#x66F4;&#x591A;&#x8BE6;&#x7EC6;&#x4FE1;&#x606F;&#x8BF7;&#x53C2;&#x8003;<a href="http://docs.nuget.org/Consume/Package-Manager-Dialog" target="_blank">Package Manager Dialog</a>&#x548C;<a href="https://github.com/Microsoft/TypeScript/wiki/Nightly-drops#using-nuget-with-msbuild" target="_blank">using nightly builds with NuGet</a></p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="Compiler Options in MSBuild.html" class="navigation navigation-prev " aria-label="Previous page: 在MSBuild里使用编译选项">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="Nightly Builds.html" class="navigation navigation-next " aria-label="Next page: 使用TypeScript的每日构建版本">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"与其它构建工具整合","level":"1.5.7","depth":2,"next":{"title":"使用TypeScript的每日构建版本","level":"1.5.8","depth":2,"path":"doc/handbook/Nightly Builds.md","ref":"./doc/handbook/Nightly Builds.md","articles":[]},"previous":{"title":"在MSBuild里使用编译选项","level":"1.5.6","depth":2,"path":"doc/handbook/Compiler Options in MSBuild.md","ref":"./doc/handbook/Compiler Options in MSBuild.md","articles":[]},"dir":"ltr"},"config":{"plugins":[],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"Patrick Zhong","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"preface.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"TypeScript Handbook","language":"zh-hans","gitbook":">3.0.0","description":"Translation of official TypeScript Handbook"},"file":{"path":"doc/handbook/Integrating with Build Tools.md","mtime":"2018-10-13T09:48:54.000Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-10-13T09:57:42.904Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

